package com.poorstu.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.common.base.web.BaseAction;
import com.poorstu.manager.ClassAndCollegeManager;
import com.poorstu.manager.RoleManager;
import com.poorstu.model.CollegeMod;
import com.poorstu.model.RoleMod;

public class SelectRoleAction extends BaseAction {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		
		try{
		RoleManager roleManager=(RoleManager)getBean("roleMeg");
		ClassAndCollegeManager classAndCollege=(ClassAndCollegeManager)getBean("classAndCollegeManager");
		List<CollegeMod> listCollege=classAndCollege.selectCollegeAll();
		
		List<RoleMod> roleList=roleManager.selectRoleAll();
		
		request.setAttribute("listCollege", listCollege);
		request.setAttribute("roleList", roleList);
		   return mapping.findForward("succ");
		}catch(Exception e){
			e.printStackTrace();
			return mapping.findForward("failure");
		}
	}
		
	

}
